ninab222 2.2.2
Loading...
Searching...
No Matches
NINA-B222 Click Driver

API for configuring and manipulating NINA-B222 Click driver. More...

Topics

 NINA-B222 Device Settings
 Settings for registers of NINA-B222 Click driver.
 NINA-B222 MikroBUS Map
 MikroBUS pin mapping of NINA-B222 Click driver.

Functions

void ninab222_cfg_setup (ninab222_cfg_t *cfg)
 NINA-B222 configuration object setup function.
err_t ninab222_init (ninab222_t *ctx, ninab222_cfg_t *cfg)
 NINA-B222 initialization function.
err_t ninab222_generic_write (ninab222_t *ctx, uint8_t *data_in, uint16_t len)
 NINA-B222 data writing function.
err_t ninab222_generic_read (ninab222_t *ctx, uint8_t *data_out, uint16_t len)
 NINA-B222 data reading function.
void ninab222_hw_reset (ninab222_t *ctx)
 NINA-B222 HW reset function.
err_t ninab222_write_cmd (ninab222_t *ctx, uint8_t *command)
 NINA-B222 command writing function.
err_t ninab222_write_sys_cmd (ninab222_t *ctx, uint8_t *command)
 NINA-B222 system command writing function.
err_t ninab222_write_cmd_param (ninab222_t *ctx, uint8_t *command, uint8_t *param)
 NINA-B222 command - parameter writing function.
err_t ninab222_inquire_cmd (ninab222_t *ctx, uint8_t *command)
 NINA-B222 inquire command function.
err_t ninab222_rst_def_cfg (ninab222_t *ctx)
 NINA-B222 set to factory defined configuration function.
err_t ninab222_reboot_dce (ninab222_t *ctx)
 NINA-B222 reboot DCE function.
err_t ninab222_set_bt_intf (ninab222_t *ctx)
 NINA-B222 store current configuration function.
err_t ninab222_set_start_mode (ninab222_t *ctx, uint8_t start_mode)
 NINA-B222 sets start mode function.
err_t ninab222_get_start_mode (ninab222_t *ctx)
 NINA-B222 get start mode function.
err_t ninab222_set_enter_mode (ninab222_t *ctx, uint8_t enter_mode)
 NINA-B222 sets enter mode function.
err_t ninab222_set_echo (ninab222_t *ctx, uint8_t echo_en)
 NINA-B222 set echo function.
err_t ninab222_set_device_name (ninab222_t *ctx, uint8_t *device_name)
 NINA-B222 sets device name function.
err_t ninab222_get_device_name (ninab222_t *ctx)
 NINA-B222 get device name function.
err_t ninab222_set_le_role (ninab222_t *ctx, uint8_t le_role)
 NINA-B222 sets low energy role function.
err_t ninab222_get_le_role (ninab222_t *ctx)
 NINA-B222 get low energy role function.
err_t ninab222_get_peers_list (ninab222_t *ctx)
 NINA-B222 get low energy role function.
err_t ninab222_set_default_cfg (ninab222_t *ctx)
 NINA-B222 sets the default configuration function.
err_t ninab222_set_pairing_mode (ninab222_t *ctx, uint8_t p_mode)
 NINA-B222 sets pairing mode function.
err_t ninab222_set_connectability (ninab222_t *ctx, uint8_t c_mode)
 NINA-B222 sets connectabilit mode function.
err_t ninab222_get_connectability (ninab222_t *ctx)
 NINA-B222 sets connectabilit mode function.
err_t ninab222_set_discoverability (ninab222_t *ctx, uint8_t d_mode)
 NINA-B222 sets discoverability mode function.
err_t ninab222_get_discoverability (ninab222_t *ctx)
 NINA-B222 sets discoverability mode function.
err_t ninab222_get_info (ninab222_t *ctx)
 NINA-B222 get module-info function.
err_t ninab222_remote_peer (ninab222_t *ctx, uint8_t *domain)
 NINA-B222 default remote peer function.
err_t ninab222_periph_pairing_cfg (ninab222_t *ctx)
 NINA-B222 default remote peer function.
void ninab222_clear_to_send (ninab222_t *ctx, uint8_t cts)
 NINA-B222 set clear to send pin state function.
uint8_t ninab222_request_to_send (ninab222_t *ctx)
 NINA-B222 get request to send pin state function.
void ninab222_set_sry_pin (ninab222_t *ctx, uint8_t state)
 NINA-B222 set SRY pin state function.
void ninab222_set_io5_pin (ninab222_t *ctx, uint8_t state)
 NINA-B222 set IO5 pin state function.

Detailed Description

API for configuring and manipulating NINA-B222 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ ninab222_cfg_setup()

void ninab222_cfg_setup ( ninab222_cfg_t * cfg)

NINA-B222 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See ninab222_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ ninab222_clear_to_send()

void ninab222_clear_to_send ( ninab222_t * ctx,
uint8_t cts )

NINA-B222 set clear to send pin state function.

This function sets a desired logic state of the CTS (CS) pin.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]cts: Pin logic state.
Note
None.

◆ ninab222_generic_read()

err_t ninab222_generic_read ( ninab222_t * ctx,
uint8_t * data_out,
uint16_t len )

NINA-B222 data reading function.

This function reads a desired number of data bytes by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_generic_write()

err_t ninab222_generic_write ( ninab222_t * ctx,
uint8_t * data_in,
uint16_t len )

NINA-B222 data writing function.

This function writes a desired number of data bytes by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_connectability()

err_t ninab222_get_connectability ( ninab222_t * ctx)

NINA-B222 sets connectabilit mode function.

This function writes a desired inquiry command to reads the GAP connectability mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_device_name()

err_t ninab222_get_device_name ( ninab222_t * ctx)

NINA-B222 get device name function.

This function writes a desired inquiry command to reads the local name used as device name for Bluetooth Classic by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_discoverability()

err_t ninab222_get_discoverability ( ninab222_t * ctx)

NINA-B222 sets discoverability mode function.

This function writes a desired inquiry command to reads the GAP discoverability mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_info()

err_t ninab222_get_info ( ninab222_t * ctx)

NINA-B222 get module-info function.

This function writes a desired inquiry commands to read the module information by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
  • Manufacturer identification,
  • Model identification,
  • Software version identification,
  • Serial number,
  • RS232 Baud Rate Settings,

◆ ninab222_get_le_role()

err_t ninab222_get_le_role ( ninab222_t * ctx)

NINA-B222 get low energy role function.

This function writes a desired inquiry command to reads the Bluetooth low energy role by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_peers_list()

err_t ninab222_get_peers_list ( ninab222_t * ctx)

NINA-B222 get low energy role function.

This function writes a desired inquiry command to reads the connected peers and lists them with connection type and peer handle by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_get_start_mode()

err_t ninab222_get_start_mode ( ninab222_t * ctx)

NINA-B222 get start mode function.

This function writes a desired inquiry command to get the start mode for the module by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_hw_reset()

void ninab222_hw_reset ( ninab222_t * ctx)

NINA-B222 HW reset function.

This function performs a hardware reset of the device.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ ninab222_init()

err_t ninab222_init ( ninab222_t * ctx,
ninab222_cfg_t * cfg )

NINA-B222 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See ninab222_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_inquire_cmd()

err_t ninab222_inquire_cmd ( ninab222_t * ctx,
uint8_t * command )

NINA-B222 inquire command function.

This function writes a desired inquire command by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]command: System command buffer for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_periph_pairing_cfg()

err_t ninab222_periph_pairing_cfg ( ninab222_t * ctx)

NINA-B222 default remote peer function.

This function sets the Bluetooth low energy role, sets the data mode for the module and reboot DCE by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_reboot_dce()

err_t ninab222_reboot_dce ( ninab222_t * ctx)

NINA-B222 reboot DCE function.

This function reboot DCE and store current configuration by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_remote_peer()

err_t ninab222_remote_peer ( ninab222_t * ctx,
uint8_t * domain )

NINA-B222 default remote peer function.

This function remote peer when entering either the Data mode or Extended data mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]domain: Specifies Bluetooth address of the remote device.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_request_to_send()

uint8_t ninab222_request_to_send ( ninab222_t * ctx)

NINA-B222 get request to send pin state function.

This function return logic state of the RTS (INT) pin.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
Logic state of the CTS pin.
Note
None.

◆ ninab222_rst_def_cfg()

err_t ninab222_rst_def_cfg ( ninab222_t * ctx)

NINA-B222 set to factory defined configuration function.

This function sets to factory defined configuration and performs module switches by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_bt_intf()

err_t ninab222_set_bt_intf ( ninab222_t * ctx)

NINA-B222 store current configuration function.

This function sets the local address of the Bluetooth interface by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_connectability()

err_t ninab222_set_connectability ( ninab222_t * ctx,
uint8_t c_mode )

NINA-B222 sets connectabilit mode function.

This function sets the GAP connectability mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]c_mode: GAP connectability mode [0-1].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_default_cfg()

err_t ninab222_set_default_cfg ( ninab222_t * ctx)

NINA-B222 sets the default configuration function.

This function resets the profile to the last stored configuration and reboot the DCE by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]le_role: Bluetooth low energy role [0-3].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_device_name()

err_t ninab222_set_device_name ( ninab222_t * ctx,
uint8_t * device_name )

NINA-B222 sets device name function.

This function sets the local name used as device name for Bluetooth Classic by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]device_name: Device name.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_discoverability()

err_t ninab222_set_discoverability ( ninab222_t * ctx,
uint8_t d_mode )

NINA-B222 sets discoverability mode function.

This function sets the GAP discoverability mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]d_mode: GAP discoverability mode [0-1].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_echo()

err_t ninab222_set_echo ( ninab222_t * ctx,
uint8_t echo_en )

NINA-B222 set echo function.

This function configures whether or not the unit echoes the characters received from the DTE in Command Mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]echo_en: Echo On/Off [0-1].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_enter_mode()

err_t ninab222_set_enter_mode ( ninab222_t * ctx,
uint8_t enter_mode )

NINA-B222 sets enter mode function.

This function requests the module to move to the new mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]enter_mode: Enter mode [0-3].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_io5_pin()

void ninab222_set_io5_pin ( ninab222_t * ctx,
uint8_t state )

NINA-B222 set IO5 pin state function.

This function sets a desired logic state of the IO5 (PWM) pin.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]cts: Pin logic state.
Note
None.

◆ ninab222_set_le_role()

err_t ninab222_set_le_role ( ninab222_t * ctx,
uint8_t le_role )

NINA-B222 sets low energy role function.

This function sets the Bluetooth low energy role by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]le_role: Bluetooth low energy role [0-3].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_pairing_mode()

err_t ninab222_set_pairing_mode ( ninab222_t * ctx,
uint8_t p_mode )

NINA-B222 sets pairing mode function.

This function enable or disable pairing mode by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]p_mode: Enable or disable pairing.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_set_sry_pin()

void ninab222_set_sry_pin ( ninab222_t * ctx,
uint8_t state )

NINA-B222 set SRY pin state function.

This function sets a desired logic state of the SRY (AN) pin.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]cts: Pin logic state.
Note
None.

◆ ninab222_set_start_mode()

err_t ninab222_set_start_mode ( ninab222_t * ctx,
uint8_t start_mode )

NINA-B222 sets start mode function.

This function sets the start mode for the module by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]start_mode: Start mode [0-3].
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_write_cmd()

err_t ninab222_write_cmd ( ninab222_t * ctx,
uint8_t * command )

NINA-B222 command writing function.

This function writes a desired command by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]command: Command buffer for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_write_cmd_param()

err_t ninab222_write_cmd_param ( ninab222_t * ctx,
uint8_t * command,
uint8_t * param )

NINA-B222 command - parameter writing function.

This function writes a desired command and parameter by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]command: System command buffer for sending.
[in]param: Parameter buffer for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ninab222_write_sys_cmd()

err_t ninab222_write_sys_cmd ( ninab222_t * ctx,
uint8_t * command )

NINA-B222 system command writing function.

This function writes a desired system command by using the UART serial interface.

Parameters
[in]ctx: Click context object. See ninab222_t object definition for detailed explanation.
[in]command: System command buffer for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.